package com.fimmlps.reronge.dto;

import com.fimmlps.reronge.entity.EntryUser;
import com.fimmlps.reronge.entity.EntryUserApply;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class MessageDto {
    //视情况拓展内容
    //消息DTO 主要有 好友申请消息 和 编辑权申请消息（待定）
    //主ID
    private long mainId;
    // 0-friend apply 1-other
    private long messageType;
    private String userName1;
    private String userName2;
    private String messageContent;
    private LocalDateTime createTime;

    public MessageDto(EntryUserApply apply, EntryUser user1,EntryUser user2){
        mainId = apply.getEntryUserApplyId();
        messageType = 0;
        userName1 = user1.getUserName();
        userName2 = user2.getUserName();
        messageContent = userName1 + "向你发起好友请求";
        createTime = apply.getCreateTime();
    }

    public MessageDto(EntryUserApply apply, EntryUser user){
        mainId = apply.getEntryUserApplyId();
        messageType = 1;
        userName1 = user.getUserName();
        messageContent = userName1 + "申请编辑权限";
        createTime = apply.getCreateTime();
    }
}
